import request from '@/utils/request'

//雷达信号文件查询
export function radarSingalPost(data) {
  return request({
    url: '/radar/selectRadar',
    method: 'post',
    data: data
  })
}
//雷达信号文件修改
export function radarSingalEdit(data) {
  return request({
    url: '/radar/editRadar',
    method: 'put',
    data
  })
}

//雷达信号文件删除
export function RadarDelete(query) {
  return request({
    url: '/radar/deleteRadar',
    method: 'delete',
    params: query
  })
}

//雷达信号文件下载
export function radarSignalFileLoad(data) {
  return request({
    url: '/radar/export',
    method: 'get',
    params: data,
    headers: {
      'Content-Type': 'application/octet-stream'
    },
    responseType: 'arraybuffer'
  })
}

//单个文件列表查询
export function signalListGet(data) {
  return request({
    url: '/file',
    method: 'get',
    params: data
  })
}
//信号文件新增
export function signalListAdd(data) {
  return request({
    url: '/file/add',
    method: 'post',
    data: data
  })
}

//信号文件导入
export function signalFileExport(data, params) {
  return request({
    url: '/file/importData',
    method: 'post',
    data,
    params,
    transformRequest: [
      function (data) {
        // 将请求数据转换成功 formdata 接收格式
        const formdata = new FormData()
        formdata.append('file', data)
        return formdata
      }
    ],
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

//获取字典数据
export function signalDataGet(query) {
  return request({
    url: '/file/dataType',
    method: 'get',
    params: query
  })
}
